{ INFORMATICS.MCCME.RU
  Problem statement: http://informatics.mccme.ru/moodle/mod/statements/view3.php?chapterid=1922
  Verdict: Accepted
}
uses 
	SysUtils, Math;
 
var
	i,n,m,j,k:longint;
	ans,s:string;
	ca,cur:int64;
 
begin
reset(input,'input.txt');
rewrite(output,'output.txt');
readln(n,m);
ans:='';
ca:=round(1e16);
for i:=1 to n do begin
	readln(s);
	cur:=0;
	for j:=1 to m do begin
		read(k);
		inc(cur,k);
	end;
	readln;
	if cur<ca then begin
		ca:=cur;
		ans:=s;
	end;
end;
write(ans);
end.